package com.czkt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.czkt.entity.CstService;
import com.czkt.entity.vo.CstServiceAndBasDict;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2024-06-18
 */
@Mapper
public interface CstServiceMapper extends BaseMapper<CstService> {
    @Select("select * from cst_service where svr_cust_name like concat('%',#{svrCustName},'%') and svr_due_to like concat('%',#{svrDueTo},'%') and svr_title like concat('%',#{svrTitle},'%') ")
    IPage<CstService> selectService(IPage<CstService> serviceIPage, @Param("svrCustName") String svrCustName, @Param("svrDueTo") String svrDueTo, @Param("svrTitle") String svrTitle);


    @Select("select * from cst_service where svr_cust_name like concat('%',#{svrCustName},'%') and svr_type like concat('%',#{svrType},'%') and svr_title like concat('%',#{svrTitle},'%') and svr_status != '4'")
    IPage<CstService> selectServiceAndBasDict(IPage<CstService> serviceIPage, @Param("svrCustName") String svrCustName, @Param("svrType") String svrType, @Param("svrTitle") String svrTitle);

    @Select("select * from cst_service left join bas_dict on cst_service.svr_status = bas_dict.dict_value where cst_service.svr_cust_name like concat('%',#{svrCustName},'%') and cst_service.svr_type like concat('%',#{svrType},'%') and cst_service.svr_title like concat('%',#{svrTitle},'%') and cst_service.svr_status = '4' and bas_dict.dict_type = '服务状态'")
    IPage<CstServiceAndBasDict> selectServiceAndArch(IPage<CstServiceAndBasDict> serviceIPage, @Param("svrCustName") String svrCustName, @Param("svrType") String svrType, @Param("svrTitle") String svrTitle);

    @Select("select * from cst_service where svr_cust_name like concat('%',#{svrCustName},'%') and svr_type like concat('%',#{svrType},'%') and svr_title like concat('%',#{svrTitle},'%') and svr_status = '3'")
    IPage<CstService> selectServiceAndFeedback(IPage<CstService> serviceIPage, @Param("svrCustName") String svrCustName, @Param("svrType") String svrType, @Param("svrTitle") String svrTitle);

    @Select("select * from cst_service where svr_cust_name like concat('%',#{svrCustName},'%') and svr_type like concat('%',#{svrType},'%') and svr_title like concat('%',#{svrTitle},'%') and svr_status = '2'")
    IPage<CstService> selectServiceDeal(IPage<CstService> serviceIPage, @Param("svrCustName") String svrCustName, @Param("svrType") String svrType, @Param("svrTitle") String svrTitle);

}
